package com.lantosec.hmrp.modules.eval.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.eval.vo.EvalTaskVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * <p>
 * 考评任务 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-03-30
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class EvalTask extends BaseEntity<EvalTaskVO> {

    private static final long serialVersionUID = 1L;
    public EvalTask(EvalTaskVO vo){
        this.evalTaskId = vo.getEvalTaskId();
        this.evalPlanId = vo.getEvalPlanId();
        this.evalMode = vo.getEvalMode();
        this.startDate = vo.getStartDate();
        this.endDate = vo.getEndDate();
        this.state = vo.getState();
        this.delay = vo.getDelay();
        this.execNum = vo.getExecNum();
        this.targetNum = vo.getTargetNum();
        this.performNum = vo.getPerformNum();
        this.taskTitle = vo.getTaskTitle();
        this.createUser = vo.getCreateUser();
        this.createUserId = vo.getCreateUserId();
        this.createTime = vo.getCreateTime();
    }

    @Override
    public EvalTaskVO convertToVO(){
        return new EvalTaskVO(this);
    }


    /**
     * 考评任务ID
     */
    @TableId(value = "eval_task_id", type = IdType.AUTO)
    private Integer evalTaskId;

    /**
     * 考评计划ID
     */
    private Integer evalPlanId;

    /**
     * 考评形式
     */
    private Integer evalMode;

    /**
     * 任务开始日期
     */
    private String startDate;

    /**
     * 任务结束日期
     */
    private String endDate;

    /**
     * 任务标题
     */
    private String taskTitle;

    /**
     * 创建人
     */
    private String createUserId;

    /**
     * 创建人ID
     */
    private String createUser;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 计划状态(1暂停2启用3到期4作废)
     */
    private Integer state;

    /**
     * 允许延期(工作日)
     */
    private Integer delay;

    /**
     * 要求执行次数
     */
    private Integer execNum;

    /**
     * 执行对象数
     */
    private Integer targetNum;

    /**
     * 执行完成数
     */
    private Integer performNum;


    public enum ColName {
        eval_task, eval_plan_id, eval_mode, taskTitle, start_date, end_date, state, delay, exec_num, target_num, perform_num,
    }
}
